<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-05-04 11:06:09
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-05-04 11:33:11
 * @FilePath: \geyao\对象220504.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>引用数据类型 和值数据类型</title>
</head>
<body>
  <script>
    function test(person) {
  person.age = 26
  person = {
    name: 'yyy',
    age: 30
  }

  return person
}
const p1 = {
  name: 'yck',
  age: 25
}
const p2 = test(p1)
console.log(p1) // -> {  name: 'yck',age: 26}
console.log(p2) // -> {  name: 'yyy',age: 30}
  </script>
</body>
</html>